<template>
  <div class="right">
    <div class="info">
      <el-row>
        <div>{{infoData.dep_date}}</div>
        <div>{{infoData.org_city_name}} - {{infoData.dst_city_name}}</div>
      </el-row>
      <div class="airline">
        <div class="item">
          <h3>{{infoData.dep_time}}</h3>
          <span>{{infoData.org_airport_name}}{{infoData.org_airport_quay}}</span>
        </div>
        <div class="item">
          <span>--- {{ApartTime}} ---</span>
          <span>{{infoData.airline_name}}{{infoData.flight_no}}</span>
        </div>
        <div class="item">
          <h3>{{infoData.arr_time}}</h3>
          <span>{{infoData.dst_airport_name}}{{infoData.dst_airport_quay}}</span>
        </div>
      </div>
    </div>
    <div class="item">
      <span>订单总价</span>
      <span>金额</span>
      <span>数量</span>
    </div>
    <div class="item">
      <span>成人机票</span>
      <span>￥{{infoData.seat_infos.org_settle_price}}</span>
      <span>x1</span>
    </div>
    <div class="item">
      <span>机建+燃油</span>
      <span>￥{{infoData.airport_tax_audlet}}/人单程</span>
      <span>x1</span>
    </div>
    <div class="total">
      <span>应付总额：</span>
      <span>￥{{totalPrice+infoData.airport_tax_audlet*length}}</span>
    </div>
  </div>
</template>
<script>
export default {
  props:{
    infoData:Object,
    totalPrice:Number,
    length:Number
  },
  created() {
    console.log(this.infoData)
  },
  computed: {
    ApartTime() {
      if (this.infoData) {
        const startArr = this.infoData.dep_time.split(':')
        const endArr = this.infoData.arr_time.split(':')
        const startMin = +startArr[0] * 60 + +startArr[1]
        let endMin = +endArr[0] * 60 + +endArr[1]
        if (endMin < startMin) {
          endMin += 24 * 60
        }
        const hours = Math.floor((endMin - startMin) / 60)
        const mins = (endMin - startMin) % 60
        return `${hours}小时${mins}分`
      }
    }
  }
}
</script>
<style lang="less" scoped>
.right {
  width: 352px;
  height: 280px;
  // background: red;
  border: 1px solid #ddd;
  margin-left: 50px;
  font-size: 14px;
  .info {
    border-bottom: 1px dashed #ddd;
    padding: 10px 20px;
    .el-row {
      margin-bottom: 10px;
      div {
        width: 49%;
        display: inline-block;
        &:nth-child(2) {
          text-align: right;
        }
      }
    }
    .airline {
      display: flex;
      justify-content: space-between;
      .item {
        &:nth-child(2) {
          flex: 1;
        }
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        h3 {
          font-size: 22px;
          font-weight: 400;
        }
        span {
          font-size: 12px;
          color: #9d9b9b;
        }
      }
    }
  }
  & > .item {
    padding: 0 20px;
    height: 40px;
    line-height: 40px;
    border-bottom: 1px dashed #ddd;
    color: #6d6d6d;
    display: flex;
    justify-content: center;
    span {
      &:nth-child(2) {
        text-align: center;
        flex: 1;
      }
    }
  }
  .total {
    // background:#000;
    height: 60px;
    line-height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    color: #6d6d6d;
    span {
      &:nth-child(2) {
        color: #ffa511;
        font-size: 30px;
      }
    }
  }
}
</style>